﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DSS_XNA.Engine.Error;
using DSS_XNA.Engine.Script;

namespace DSS_XNA.Engine.Script.Commands
{
    public class ScriptCommand_LoadHUD
    {
        #region Static Methods

        public static void Action(Dictionary<string, string> args, ScriptManager manager, Game1 engine)
        {
            if (!args.ContainsKey("width"))
                throw new DSSException("No Width parameter for LoadHUD");
            if (!args.ContainsKey("height"))
                throw new DSSException("No Height parameter for LoadHUD");
            if (!args.ContainsKey("x"))
                throw new DSSException("No X parameter for LoadHUD");
            if (!args.ContainsKey("y"))
                throw new DSSException("No Y parameter for LoadHUD");
            if (!args.ContainsKey("background"))
                throw new DSSException("No Background parameter for LoadHUD");

            int width = Convert.ToInt32(manager.GetParameterValue(args["width"]));
            int height = Convert.ToInt32(manager.GetParameterValue(args["height"]));
            int x = Convert.ToInt32(manager.GetParameterValue(args["x"]));
            int y = Convert.ToInt32(manager.GetParameterValue(args["y"]));
            string background = manager.GetParameterValue(args["background"]).ToString();

            if (engine.Hud == null)
                engine.Hud = new DSS_XNA.Engine.HUD.HUD();
            engine.Hud.Load(engine.Content, width, height, x, y, background);
        }

        #endregion
    }
}
